﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Microsoft.VisualStudio.TestTools.UnitTesting;

//namespace Pibby.Core.Tests
//{
//    [TestClass]
//    public class EpisodeClassifierTests
//    {
//        [TestMethod]
//        [ExpectedException (typeof(ArgumentNullException))]
//        public void ClassifingEpisodeNullObjectThrowsException()
//        {
//            Stubs.EpisodeStub ep = null;

//            DateTime lastUpdate = DateTime.Today;

//            EpisodeClassifier classify = new EpisodeClassifier(lastUpdate);

//            classify.Classify(ep);

//            Assert.Fail("Should not get here");
//        }

//        [TestMethod]
//        public void EpisodesPublishedSinceLastUpdateAreClassifiedAsNew()
//        {
//            Stubs.EpisodeStub brandNewEp = new Stubs.EpisodeStub("Episode 99", DateTime.Today);
//            Stubs.EpisodeStub newishEp = new Stubs.EpisodeStub("Episode 98", DateTime.Today.AddDays (-1));
//            Stubs.EpisodeStub recentEp = new Stubs.EpisodeStub("Episode 97", DateTime.Today.AddDays(-7));

//            // last updated 2 weeks ago - all the new episodes since then will be non-backcatalog
//            DateTime lastUpdate = DateTime.Today.AddDays(-14);

//            EpisodeClassifier classify = new EpisodeClassifier(lastUpdate);
//            classify.NewThreshold = 1;
//            classify.RecentThreshold = 5;

//            Assert.AreEqual(EpisodeAge.BrandNew, classify.Classify(brandNewEp));
//            Assert.AreEqual(EpisodeAge.Newish, classify.Classify(newishEp));
//            Assert.AreEqual(EpisodeAge.Recent, classify.Classify(recentEp));
//        }

//        [TestMethod]
//        public void EpisodePublishedAtLastUpdateIsClassifiedBackCatalog()
//        {
//            DateTime lastPublishedDate = DateTime.Today.AddDays(-5);

//            Stubs.EpisodeStub ep = new Stubs.EpisodeStub("Episode 99", lastPublishedDate);

//            EpisodeClassifier classify = new EpisodeClassifier(DateTime.Today);
//            classify.BackCatalogThreshold = 5;

//            Assert.AreEqual(EpisodeAge.BackCatalog, classify.Classify(ep));
//        }

//        [TestMethod]
//        public void EpisodesPublishedPriorToLastUpdateAreClassifiedBackCatalog()
//        {
//            DateTime lastPublishedDate = DateTime.Today.AddDays(-5);

//            Stubs.EpisodeStub ep1 = new Stubs.EpisodeStub("Episode 3", lastPublishedDate.AddDays(-1));
//            Stubs.EpisodeStub ep2 = new Stubs.EpisodeStub("Episode 2", lastPublishedDate.AddDays(-25));
//            Stubs.EpisodeStub ep3 = new Stubs.EpisodeStub("Episode 1", lastPublishedDate.AddDays(-365));

//            EpisodeClassifier classify = new EpisodeClassifier(DateTime.Today);
//            classify.BackCatalogThreshold = 5;

//            Assert.AreEqual(EpisodeAge.BackCatalog, classify.Classify(ep1));
//            Assert.AreEqual(EpisodeAge.BackCatalog, classify.Classify(ep2));
//            Assert.AreEqual(EpisodeAge.BackCatalog, classify.Classify(ep3));
//        }

//        [TestMethod]
//        public void EpisodesPublishedLongAgoWithUndatedPodcastAreClassifiedBackCatalog()
//        {
//            Stubs.EpisodeStub ep1 = new Stubs.EpisodeStub("Episode 1", DateTime.Today.AddDays(-365));

//            EpisodeClassifier classify = new EpisodeClassifier(DateTime.MinValue);

//            Assert.AreEqual(EpisodeAge.BackCatalog, classify.Classify(ep1));
//        }

//    }
//}
